package com.ruoyi.teacher.shuangshi.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.teacher.shuangshi.domain.Shuangshi;
import com.ruoyi.teacher.shuangshi.mapper.ShuangshiMapper;
import com.ruoyi.teacher.shuangshi.service.IShuangshiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 双师书法Service业务层处理
 * 
 * @author duanxinli
 * @date 2025-09-08
 */
@Service
public class ShuangshiServiceImpl implements IShuangshiService
{
    @Autowired
    private ShuangshiMapper shuangshiMapper;

    /**
     * 查询双师书法
     * 
     * @param id 双师书法主键
     * @return 双师书法
     */
    @Override
    public Shuangshi selectShuangshiById(String id)
    {
        return shuangshiMapper.selectShuangshiById(id);
    }

    /**
     * 查询双师书法列表
     * 
     * @param shuangshi 双师书法
     * @return 双师书法
     */
    @Override
    public List<Shuangshi> selectShuangshiList(Shuangshi shuangshi)
    {
        return shuangshiMapper.selectShuangshiList(shuangshi);
    }

    /**
     * 新增双师书法
     * 
     * @param shuangshi 双师书法
     * @return 结果
     */
    @Override
    public int insertShuangshi(Shuangshi shuangshi)
    {
        shuangshi.setId(IdUtils.fastUUID());
        if (shuangshi.getCreateDate()==null){
            shuangshi.setCreateDate(DateUtils.getNowDate());
        }
        String username = SecurityUtils.getUsername();
        shuangshi.setCreateBy(username);
        shuangshi.setSort(0L);
        return shuangshiMapper.insertShuangshi(shuangshi);
    }

    /**
     * 修改双师书法
     * 
     * @param shuangshi 双师书法
     * @return 结果
     */
    @Override
    public int updateShuangshi(Shuangshi shuangshi)
    {
        return shuangshiMapper.updateShuangshi(shuangshi);
    }

    /**
     * 批量删除双师书法
     * 
     * @param ids 需要删除的双师书法主键
     * @return 结果
     */
    @Override
    public int deleteShuangshiByIds(String[] ids)
    {
        return shuangshiMapper.deleteShuangshiByIds(ids);
    }

    /**
     * 删除双师书法信息
     * 
     * @param id 双师书法主键
     * @return 结果
     */
    @Override
    public int deleteShuangshiById(String id)
    {
        return shuangshiMapper.deleteShuangshiById(id);
    }
}
